/**
 * https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal
 * // Definition for a Node.
 * function Node(val, children) {
 *    this.val = val;
 *    this.children = children;
 * };
 */

/**
 * @param {Node|null} root
 * @return {number[]}
 */
 var preorder = function(root) {
  const results = [];
  function preo(node) {
      if (!node) {
          return;
      }
      results.push(node.val);
      node.children.map(preo);
  }
  preo(root);
  return results;
};
